﻿using System.ComponentModel;
using RaytracerLib;

namespace Raytracer.PropertyGridDecorators
{
    public class SceneActorProperties
    {
        private SceneActor m_scene_actor;

        public SceneActorProperties(SceneActor a_scene_actor)
        {
            m_scene_actor = a_scene_actor;
        }

        [Category(Categories.PROPERTIES)]
        public string Name
        {
            get
            {
                return m_scene_actor.Name;
            }
            set
            {
                m_scene_actor.Name = value;
            }
        }

        [Category(Categories.ORIENTATION)]
        [TypeConverter(typeof(Vector3Converter))]
        public Vector3Properties Pos
        {
            get
            {
                return new Vector3Properties(
                    () => m_scene_actor.Pos,
                    (v) => m_scene_actor.Pos = v);
            }
            set
            {
                m_scene_actor.Pos = value.ToVector3();
            }
        }

        [Category(Categories.ORIENTATION)]
        [TypeConverter(typeof(AABBConverter))]
        public AABBReadonlyProperties BoundBox
        {
            get
            {
                return new AABBReadonlyProperties(m_scene_actor.BoundBox);
            }
        }
    }
}